<?php
namespace app\common\exception;
use app\common\enum\ErrorCodeEnum;
use app\common\enum\HttpCodeEnum;

/**
 * 创建成功（如果不需要返回任何消息）
 */
class SuccessException extends BaseException {

    public function __construct(array $params = [])
    {
        $this->code = array_key_exists('code', $params) ? $params['code'] : HttpCodeEnum::CODE_200;
        $this->msg = array_key_exists('msg', $params) ? $params['msg'] : 'OK';
        $this->error_code = array_key_exists('error_code', $params) ? $params['error_code'] : ErrorCodeEnum::SUCCESS;
        $this->content = array_key_exists('content', $params) ? $params['content'] : '';
        parent::__construct($params);
    }
}